package edu.hrbu.kwaidu.exception;

import edu.hrbu.kwaidu.common.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author xudengyu
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(CustomException.class)
    public R processCustomException(CustomException e){
        return R.fail(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    public R processCustomException(Exception e){
        return R.fail(e.getMessage());
    }
}
